<%@ page language="java" contentType="text/html"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户管理</title>
<link rel="stylesheet" href="css/bootstrap.css" />
<link rel="stylesheet" href="css/css.css" />
<script type="text/javascript" src="js/jquery1.9.0.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/sdmenu.js"></script>
<script type="text/javascript" src="js/laydate/laydate.js"></script>
<script type="text/javascript">
function add(){
	 $.ajax({
   	 type: "POST",
    	 url: "customer/query.action",
    	 data: {cname:$("#cname").val(),
    		 age:$("#age").val(),
    		 sex:$("#sex").val(),
    		 idcard:$("#idcard").val(),
    		 phonenum:$("#phonenum").val(),
    		 visittype:$("#visittype").val(),
    		 customertype:$("#customertype").val(),
    		 address:$("#address").val()},
     	 dataType: "json",
     	success:function(data){  
   		alert("添加成功！");
   		window.location.href="List.action"; 
    	 }, 
   	error: function(data){
   		alert("请认真核对信息。");
   	}
});
}
function checkMessage(){
var cname = $("#cname").val();
var age = $("#age").val();
var sex = $("#sex").val();
var idcard = $("#idcard").val();
var phonenum = $("#phonenum").val();
var address = $("#address").val();
 if(cname==""){
	 alert("姓名不能为空！");
	 $("#cname").focus();
	 return false;
 }
 if(age==""){
		 alert("年龄不能为空！"); 
		 $("#age").focus();
		 return false;
	  }
 if(sex==""){
		 alert("请选择性别！"); 
		 $("#sex").focus();
		 return false;
	  }
 if(idcard==""){
		 alert("身份证号码不能为空！"); 
		 $("#idcard").focus();
		 return false;
	  }
 if(phonenum==""){
		 alert("联系方式不能为空！"); 
		 $("#phonenum").focus();
		 return false;
	  }
 if(address==""){
		 alert("通讯地址不能为空！"); 
		 $("#address").focus();
		 return false;
	  }
 return true;
}
</script>

</head>

<body>

     <div class="right"  id="mainFrame">
     
     <div class="right_cont">
<ul class="breadcrumb">
	当前位置：<a href="index.jsp">首页</a> <span class="divider">/</span>
  	<a href="#">销售管理</a> <span class="divider">/</span>客户管理
</ul>
   
   <div class="title_right"><strong>添加客户信息</strong></div>  
   
<div style="width:900px;margin:auto;">
     <table class="table table-bordered">
     <tr>
     <td align="right" nowrap="nowrap" bgcolor="#f1f1f1">客户姓名：</td>
     <td><input type="text" name="cname" id="cname"  class="span1-1" /></td>
     <td align="right" nowrap="nowrap" bgcolor="#f1f1f1">年龄：</td>
     <td><input type="text" name="age" id="age"  class="span1-1" /></td>
     <td align="right" nowrap="nowrap" bgcolor="#f1f1f1">性别：</td>
     <td><select name="sex" id="sex" class=" span1-1">
            <option value ="男">男</option>
            <option value ="女">女</option>
          </select>  </td>
     </tr>
     <tr>
       <td align="right" nowrap="nowrap" bgcolor="#f1f1f1">身份证：</td>
       <td><input type="text" name="idcard" id="idcard"  class="span1-1" /></td>
       <td align="right" nowrap="nowrap" bgcolor="#f1f1f1">电话号：</td>
       <td><input type="text" name="phonenum" id="phonenum"  class="span1-1" /></td>
       
     </tr>
       </table>
      
      <table class="table table-bordered" >
        <tr>
          <td align="right" nowrap="nowrap" bgcolor="#f1f1f1">来访类型：</td>
          <td nowrap="nowrap"><select name="visittype" id="visittype" class=" span1-1">
            <option>电话</option>
            <option>网络</option>
          </select>    
     </td>
     <td align="right" nowrap="nowrap" bgcolor="#f1f1f1">客户类型：</td>
          <td nowrap="nowrap"><select name="customertype" id="customertype" class=" span1-1">
            <option>个人</option>
            <option>公司</option>
          </select>
         
     </td>
        </tr>
        <tr>
          <td align="right" nowrap="nowrap" bgcolor="#f1f1f1">通讯地址：</td>
          <td colspan="5" nowrap="nowrap"><input type="text" name="address" id="address" class="span10"  /></td>
          </tr>
      </table>
           
     <table  class="margin-bottom-20  table no-border" >
       <tr>
     	<td class="text-center"><input type="button" onclick="return checkMessage()&&add()" value="添加" class="btn btn-info  " style="width:80px;" /></td>
     </tr>
   </table>
   </div>    
 </div>     
</div></div>

</body>
</html>
